package com.wpp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wpp.dao.FavoriteBoxDao;
import com.wpp.domain.FavoriteBox;
import com.wpp.service.FavoriteBoxService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FavoriteBoxServiceImpl implements FavoriteBoxService {

    @Resource
    private FavoriteBoxDao favoriteBoxDao;

    @Override
    public FavoriteBox getBookMarkId(Integer id) {
        FavoriteBox box = new FavoriteBox();
        box.setBoxName("书签");
        box.setUserId(id);
        return favoriteBoxDao.selectOne(new QueryWrapper<>(box));
    }

    @Override
    public List<FavoriteBox> findAll(FavoriteBox box) {
        return favoriteBoxDao.selectList(new QueryWrapper<>(box));
    }

    @Override
    public FavoriteBox findOne(Integer boxId) {
        FavoriteBox box = new FavoriteBox();
        box.setId(boxId);
        return favoriteBoxDao.selectOne(new QueryWrapper<>(box));
    }
}
